// 统一管理接口地址
import request from '@/request/request.js'
import qs from 'qs'

// 定义对应的接口
// 定义函数
// 推荐精品接口
/*
    export default 一个文件中只能有一个，名字叫默认导出
    export const一个文件中可以有好多个，名字叫命名导出*/
export const JingPinAPI = () => request.get("/products/recommend")

// 热门兑换
export const ReMenAPI = () => request.get("/products/hot")

// 发送短信验证码
export const SendSMSAPI = (params) => request.post('/sendSMS', qs.stringify(params))

// 手机号密码登录(含注册)
export const PhoneReginAPI = (params) => request.post("/phoneRegin", qs.stringify(params))

// 微信扫码登录
export const WeiXinLoginAPI = (params) => request.post("/wechatUsers/PCLogin", qs.stringify(params))

// 手机绑定微信
export const BindingAPI = (params) => request.post("/wechatUsers/binding", qs.stringify(params))

// 获取用户信息/shop/userProfiles
export const UserProfilesAPI = () => request.get("/shop/userProfiles")

// 根据id获取详情页
export const GoodsDetailsAPI = (id) => request.get(`/products/${id}`)
// 加入购物车/shop/carts/add
export const CartsAddAPI = (params) => request.post("/shop/carts/add", qs.stringify(params))

// 全部商品/products
export const GoodsSearchAPI = (params) => request.get("/products", { params })

// 查看购物策划/shop/carts
export const CartDataAPI = () => request.get("/shop/carts")